package cn.kgc.spring.service;

import cn.kgc.spring.dao.NewUserDaoImpl;
import cn.kgc.spring.dao.UserDao;
import cn.kgc.spring.dao.UserDaoImpl;
import cn.kgc.spring.factory.BeanFactory;

/**
 * @author: mosin
 * @version: v1.0  2022/10/11
 */
public class UserServiceImpl implements UserService {

    //private UserDao userDao =  new UserDaoImpl();
    //private UserDao userDao =  new NewUserDaoImpl();
    //通过工厂类 获取userDao的实现类
    //private UserDao userDao = BeanFactory.getUserDaoImpl("cn.kgc.spring.dao.NewUserDaoImpl");
    //private  UserDao userDao = (UserDao) BeanFactory.getBean("cn.kgc.spring.dao.UserDaoImpl");

    //private  UserDao userDao = BeanFactory.getBean("cn.kgc.spring.dao.NewUserDaoImpl",UserDao.class);
    private  UserDao userDao = BeanFactory.getBean("userDaoImpl",UserDao.class);

    @Override
    public boolean deleteById(Integer id) {

        Integer line = userDao.deleteById(id);

        return line>0;
    }
}
